<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head> 
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/DateTimePicker.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/list.css">
    <script> 
	// 检索方法
	function searchListForm() {
		//var params = $("#searchForm").serialize();
		var styleNo = $("#styleNo").val();
		var orderNO = $("#orderNO").val();
		var dateStart = $("#dateStart").val();
		var tabPageStatus = $("#tabPageStatus").val();
		var orderByType = $("#orderByType").val();
		var operateId = $("#operateId").val();
		if (orderByType == "2") {
			orderByType = 1;
		}else if (orderByType == "1"){
			orderByType = 2;
		}
		$("#activity_pane").showLoading();
		$.post("${ctx}/quality/result/searchList?styleNo="
				+ styleNo
				+ "&orderNO=" + orderNO
				+ "&dateStart=" + dateStart
				+ "&tabPageStatus=" + tabPageStatus
				+ "&orderByTerm=" + operateId
				+ "&orderByType=" + orderByType,"",function(result) {
			var listHtml = result["qualityResult"];
			var pageHtml = result["page"];
			$("#listHtml").html(listHtml);
			$("#paging").html(pageHtml);
			$("#activity_pane").hideLoading();										
		}, 'json');
	}
	 
	$(function(){
		   searchListForm();
		
            $(".tabBox ul li").each(function(){
                var index=$(this).index();

                $(".tabBox ul li").eq(0).addClass("active");

                $(this).click(function(){                  
                    $(this).addClass("active").siblings().removeClass("active");
					
                    $("#tabPageStatus").val($(this).val());
                    searchListForm();
                    
					var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
					var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
					var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
					if(tabodyH>tableScrollH){
						$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px')
					}else{
						$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit')
					}
                })
            })
        })


	//重置
	function clean() {
		$("#styleNo").val("");
		$("#orderNO").val("");
		$("#dateStart").val("");
		$("#orderByType").val('1');
		$("#operateId").val('0');
		$("#orderImage").remove();
		searchListForm();
	} 

	//排序 
	function orderBy(obj,operateId) {
		var oldoPerateId = $("#operateId").val();
		var updownImage;
		if (operateId != oldoPerateId) {
			$("#orderByType").val("1");
		}
		var orderByType = $("#orderByType").val();
		$("#orderImage").remove();
		if (orderByType == "2") {
			updownImage = "<img id='orderImage' src='${ctxStatic}/images/icon-imgUp.png' style='width: 20px;height: 20px;margin-right: 2px;'/>";
			$("#orderByType").val("1");
		}else {
			updownImage = "<img id='orderImage' src='${ctxStatic}/images/icon-imgDown.png' style='width: 20px;height: 20px;margin-right: 2px;'/>";
			$("#orderByType").val("2");
		}
		$("#operateId").val(operateId);
		$(obj).append(updownImage);
		//排序检索 
		var styleNo = $("#styleNo").val();
		var orderNO = $("#orderNO").val();
		var dateStart = $("#dateStart").val();
		var tabPageStatus = $("#tabPageStatus").val();
		$("#activity_pane").showLoading();
		$.post("${ctx}/quality/result/searchList?styleNo="
				+ styleNo
				+ "&orderNO=" + orderNO
				+ "&dateStart=" + dateStart
				+ "&tabPageStatus=" + tabPageStatus
				+ "&orderByTerm=" + operateId
				+ "&orderByType=" + orderByType,"",function(result) {
			var listHtml = result["qualityResult"];
			var pageHtml = result["page"];
			$("#listHtml").html(listHtml);
			$("#paging").html(pageHtml);
			$("#activity_pane").hideLoading();										
		}, 'json');
	}
    </script>
    <style type="text/css">
	    .greenCloud{
			color: #229f24;
		}
		.grayCloud{
			color: #808080;
		}
		.redCloud{
			color: #d2322d;
		}
    
    </style>
</head>
<body>
<form id="searchForm" method="post">
 <input type="hidden" id="nowDate" value="${fns:getDate('yyyy-MM-dd')}"/>
 <input type="hidden" id="orderByType" value="1"/>
 <input type="hidden" id="operateId" value="0"/>
<div class="listArea" id="activity_pane">
	<div class="listBg">
        <div class="searchArea clearfix">
            <div class="searchLeft clearfix">       
                <!-- 交货日期 -->
                <div class="searchInp clearfix">
                    <p><spring:message code="order_shipments_date" /></p>
                    <div class="timeBox">
                        <input type="text" class="laydate-icon" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})"	id="dateStart" name="dateStart" style="width: 110px" value="">
                    </div>        
                </div>                
            	<!-- 订单号 -->
                <div class="searchInp clearfix">
                    <p class="searchTxt"><spring:message code="order_orderNo"/></p>
		            <input class="w-customer"  id="orderNO"  name="orderNO">
                </div>        
                <!-- 生产号 -->
                <div class="searchInp clearfix">
                    <p class="searchTxt"><spring:message code="style_neibu_no"/></p>
		            <input class="w-customer"  id="styleNo"  name="styleNo">
                </div>
               
            </div>
            <div class="searchRight clearfix">
                <button type="button" onclick="searchListForm();"><spring:message code="commom_check"/></button>
                <button type="button" onclick = "clean();"><spring:message code="common_reset" /></button>
            </div>
        </div>
    </div>
    
    <input type="hidden" id="tabPageStatus" name="tabPageStatus" value="0"/>
    <div class="tabBox">
        <ul class="clearfix">
            <!-- 全部 -->
            <li class="active" value="0"><spring:message code="bigConsumption_status_all" /></li>
            <!-- 已通过 -->
            <li value="1"><spring:message code="quality_pass" /></li>
            <!-- 未通过 -->
            <li value="2"><spring:message code="quality_NoPass" /></li>
        </ul>
	</div>
           
            <div class="listBg tabPadding">
        <div class="tableArea">
            <div class="tableScrollSm" style="overflow: auto;width: 1752px;height: 660px; ">
                <table cellpadding="0" class="tableHead" >
                    <thead>
                    <tr>
                        			<th><p class="table-No"><spring:message code="order_No" /></p></th>
			                        <!-- 标记 -->
			                        <th><p class="width-80px"><spring:message code="order_mark" /></p></th>
									<!-- 类别 -->
									<th><p class="width-100px"><spring:message code="contract_edit_styleType" /></p></th>
									<!-- 内部款号 -->
									<th><p class="width-180px"><spring:message code="style_neibu_no" /></p></th>
			                        <!-- 订单号 -->
									<th><p class="width-200px"><spring:message code="order_orderNo" /></p></th>
			                        <!-- 款式名称 -->
			                        <th><p class="width-120px"><spring:message code="order_style_name" /></p></th>
			                        <!-- 面料号 -->
			                        <th><p class="width-230px"><spring:message code="order_matrial_no" /></p></th>
			                        <!-- 规格 -->
			                        <th><p class="width-80px"><spring:message code="oder_matrial_guige" /></p></th>
			                        <c:forEach items="${operatingPList }" var="operate">
									<!-- 工序 -->
										<th><p class="width-120px" onclick="orderBy(this,${operate.id});">${operate.itemShortNameCn }</p></th>
									</c:forEach>
			                        <%-- <!-- 整烫前 -->
			                        <th ><p class="width-120px" onclick="orderBy(this,34);"><spring:message code="quality_34" /></p></th>
			                        <!-- 整烫后 -->
			                        <th><p class="width-120px" onclick="orderBy(this,35);"><spring:message code="quality_35" /></p></th>
			                        <!-- 尺码检测01 -->
			                        <th><p class="width-120px" onclick="orderBy(this,36);"><spring:message code="quality_36" /></p></th>
			                        <!-- 尺码检测02 -->
			                        <th><p class="width-120px" onclick="orderBy(this,37);"><spring:message code="quality_37" /></p></th> --%>
			                        <!-- 质检员 -->
			                        <th><p style="width:100px"><spring:message code="customization_user"/></p></th>
									<!-- 质检日期 -->
									<th><p style="width:100px;"><spring:message code="customization_date"/></p></th>
                    </tr>
                    </thead>
                </table>
                <table cellpadding="0" class="tableBody">
					<tbody id="listHtml">
					</tbody>
                </table>
            </div>
            </div>
        
    </div>
    <div id="paging"></div>
    </div>
</form>
</body>
</html>